package org.liveboardgames.agricola.control.delegates.action.prerequisite
{
    import org.liveboardgames.agricola.control.delegates.helper.GameHelper;
    import org.liveboardgames.agricola.model.enums.HouseTypeEnum;
    import org.liveboardgames.agricola.vo.player.Player;
    
    public class HousePrerequisiteChecker extends PrerequisiteChecker
    {
        private var material:String;
        
        public function HousePrerequisiteChecker(player:Player, material:String)
        {
            super(player);
            this.material = material;
        }
        
        override public function check():Boolean
        {
            var result:Boolean = true;
            
            // Check that the room they want to build is of the same material 
            // as the existing house
            var houseMaterial:String = GameHelper.getHouseMaterial(player.farm);
            
            // Check that the user is allowed to build the room
            if (material != houseMaterial)
            {
                result = false;
            }
            
            return result;
        }
    
    }
}